#ifndef __GAMEHACK_GAMEHACK_H__
#define __GAMEHACK_GAMEHACK_H__
#include <vector>

#include <boost/function.hpp>

#include <singleton.hpp>
#include <angelscript.h>

typedef std::vector<std::pair<LPVOID, SIZE_T>> VirtualMemoryList;

typedef boost::function<LPVOID(LPVOID, SIZE_T, DWORD, DWORD)> VirtualAllocFunction;
typedef boost::function<SC_HANDLE(LPCTSTR, LPCTSTR, DWORD)> OpenSCManagerAFunction;

class GameHack :public core::Singleton<GameHack>
{
	friend core::Singleton<GameHack>;
private:
	GameHack()
		: self_hadle_(NULL), is_initialized_(false), as_engine_(NULL)
	{}
	~GameHack()
	{}
public:
	bool Initialize(HINSTANCE dll_hanlde);
	void Finalize();
private:
	void ProcessCmd(std::string& cmd);
	void ExportToScript();
	bool CompileScript(const char *file_name);
	bool ExecuteScript(const char* file_name);
	void WorkThread(const char* file_name);
private:
	void ScriptMessageCallback(const asSMessageInfo *msg, void *param);
private:
	HINSTANCE self_hadle_;
	bool is_initialized_;
	asIScriptEngine* as_engine_;
};
#define sGameHack GameHack::GetInstance()
#endif//__GAMEHACK_GAMEHACK_H__